import TileLayer from "ol/layer/Tile";
import TileWMS from "ol/source/TileWMS";

const baseUrl = BASE_CONFIG.sliceService;

function getWMSLayer(filePath: string, format = "", url = baseUrl) {
	format = format || "image/png";
	return new TileLayer({
		source: new TileWMS({
			url,
			// format,
			params: {
				filePath: filePath,
				FORMAT: format,
				tiled: true,
				STYLES: "",
				LAYERS: "",
				fEnhanceVal: 10.0,
				nEnhanceType: 0,
				nTo8BitMethod: 2,
			},
		}),
	});
}

export default {
	getWMSLayer,
};
